package com.project.ssm.listener;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class MySpringListener implements ApplicationListener<ContextRefreshedEvent> {

    public static ApplicationContext container;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        System.out.println("hello spring listener");
        ApplicationContext applicationContext = contextRefreshedEvent.getApplicationContext();
        /*String[] strings =    applicationContext.getBeanDefinitionNames();
        for (String string:strings){
            System.out.println(string);
        }*/
        container = applicationContext;
    }
}
